package com.rockcent.mall.lib.repository;

import com.rockcent.common.domain.enumclass.Whether;
import com.rockcent.mall.lib.domain.ChannelProduct;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository;

/**
 * Created by oyhk on 16/7/29.
 *
 *
 * 中间表 需要自己实现,暂时不想使用hibernate 映射关联插入
 */
@Repository
public interface ChannelProductRepository extends JpaRepository<ChannelProduct, Long>, JpaSpecificationExecutor ,ChannelProductRepositoryCustom {

    Long countByChannelId(Long channelId);

    ChannelProduct findByProductIdAndChannelId(Long productId, Long channelId);

    void deleteByChannelId(Long channelId);

    ChannelProduct findByProductId(Long id);

    ChannelProduct findByProductIdAndChannelIdAndIsDelete(Long id, Long channelId, Whether no);
}

